﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Security.Principal;

public class UserPrincipal : GenericPrincipal
{
    public AuthenticationBLL AuthManager { get; set; }

    public UserPrincipal(IIdentity identity): base(identity, null)
    {

    }

    public UserPrincipal(IIdentity identity, AuthenticationBLL authManager)
        : base(identity, null)
    {
        this.AuthManager = authManager;
    }

    public override bool IsInRole(string role)
    {
        /*
        var response = AuthManager.ValidateAction(SubsidiaryId, this.Identity.Name, role);
        if (response.IsSuccessful)
        {
            return response.Result;
        }*/
        return false;
    }

    public static UserPrincipal GetUserPrincipal(GenericPrincipal nowUser)
    {
        return new UserPrincipal (nowUser.Identity);
    }
}
